function formatTime(d){
	const date = getDate(d);
	return date.getHours()+':'+date.getMinutes()+':'+date.getSeconds();
}
function weekByTime(d){
	var weekDay = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];  
	const date =getDate(d);
	return weekDay[date.getDay()];
}
function resDay(d){
	const date =getDate(d);
	var day=date.getDay();
	return day<10?'0'+day:day;
}

function orderStatus(d){
	let str='';
	switch(d){
		case 1:str='订单未处理';break;
		case 2:str='已装车';break;
		case 2:str='已发货';break;
		case 3:str='已到货';break;
		case 6:str='已完成';break;
	}
	return str;
}
function getDate(strDate){
  var date = eval('new Date(' + strDate.replace(/\d+(?=-[^-]+$)/, 
   function (a) { return parseInt(a, 10) - 1; }).match(/\d+/g) + ')');
  return date;
}

module.exports = {
	formatTime: formatTime,
	weekByTime: weekByTime,
	resDay: resDay,
	orderStatus: orderStatus
}